It is well known that computer operating speed benefits from providing queues that hold software instructions in the correct order as issued from the main processor, rather than completing a single issued operation instruction and then returning to the main processor to obtain the next instruction. One benefit of using queues to store the instructions temporarily while waiting for an opportunity to execute the instruction is that the main processor may issue a group of instructions to the queue, and continue operating on other portions of the overall program without having to wait for the results of the instructions to arrive. Another benefit of using queues is that the main processor may have separate queues for different types of functions and thus send out parallel series of instructions that result in increased overall system speed. Typical types of queues may include memory load queues, store to memory queues, and arithmetic operation queues.
Typically, most processors issue instructions in the same order that they are specified in the software program. This is because the order of operations is very important in a software program, and issuing instructions out of the proper order may likely result in an incorrect result. Therefore typically, the instruction queue receives the instructions in the same order as issued by the main processor, and presents them for execution in that same order. An example of the operation of a queue might be a first in first out (i.e., FIFO) system where the instruction is sent to the first available queue location in a series of queue locations. As soon as the prior queue location becomes available, the instruction is moved up, and so on until the instruction reaches the first queue memory location and is executed as soon as the needed resource is available. Note that not all queues operate in the same fashion as this illustrative example, but some method of maintaining the order of instruction issuance is needed.
The queues discussed above are a form of memory, and like any memory resource, they have a finite size or storage capacity. Making a queue larger results in greater ability to buffer the issuance of instructions from the main processor, and therefore increases the overall system operating speed in many circumstances, but at the expense of increased system cost and size. However, the main processor must know when the queue is full, i.e., when the execution of the instructions is not keeping pace with the main processor's ability to issue new instructions, or else there will be issued instructions that overflow the queue's memory capacity and become lost. A lost instruction is likely to result in an erroneous program output and consequent system failure.
Since historically the processors issued instructions in the same order as the instructions occur in the program, and the order of instructions is the same in the queues, then knowing when a queue has reached its maximum capacity, i.e., the queue is full, is important. Since the operation of a queue necessarily requires that it be known whether or not a particular memory location has a current instruction resident, then detecting whether or not the queue is full is straight forward in the case of sequentially ordered and issued instructions since all previous queue memory locations will be occupied. For example, in the illustrative FIFO case, the main processor will know to stop issuing instructions to a queue that has the last queue location filled. Note again that other queue types operate differently from the illustrative example, but in all types of queues the main processor may determine whether or not a particular queue is full.
It would improve the overall computing system speed of operation if the instructions in a queue could be executed out of the sequential order in which they were issued, since the resource (for example a particular memory location) needed for the next instruction in the normal execution order may not be available, while the resource needed for an instruction that is five memory locations behind the next instruction may be available right now. It improves the efficiency of the system to use available resources and not wait for the currently needed resource to become available. However, this requires that certain types of instructions be allowed to be executed out of the issuance order, and creates a problem with the main processor not being able to easily determine when a particular queue is full. This is because when a particular instruction, for example a memory reference instruction, issues, not all of the other memory reference instructions prior to it in the program order need necessarily have already been issued.
It would be a benefit to the overall computer system speed of operation to provide a method and an apparatus to allow random insertion of instructions into a queue while still allowing the main processor to know when the instruction queue is full.